<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
@include("layouts.common.head")
<!-- Fonts -->
    <link href="{{asset('static/css/personal/common.css')}}" rel="stylesheet" type="text/css">
    <link href="{{ asset('static/css/personal/personal_job.css') }}" rel="stylesheet">
    <link href="{{asset('static/css/personal/personal_ajax_dialog.css')}}" rel="stylesheet" type="text/css">

    <!-- Styles -->
    <style>
        html {
            overflow-y: scroll;
        }
    </style>
</head>
<body>
<div id="app">
    @include("layouts.nav")
    @include("home.other_top_nav")
    <div class="us-top">
        <div class="us-main">
            <div class="us-top-box">
                <form id="ajax_search_location" action="" method="get">
                    <div class="input-box"><input type="text" name="key" data-original="请输入关键字" value=""
                                                  placeholder="请输入关键字" autocomplete="off"></div>
                    <div class="se-btn"><input type="submit" value="搜 索"></div>
                    <div class="clear"></div>
                </form>
            </div>
        </div>
    </div>
    <div class="user_main">
        @include('member.layouts.index_left_nav')
        <div class="mainbox">
            <!--职位切换卡 -->
            <div class="tab">
                <a class="li J_hoverbut" href="{{url('member/interview')}}">面试邀请</a>
                <a class="li select" href="javascript:;">已申请职位</a>
                <div class="clear"></div>
            </div>
            <!--切换卡结束 -->

            <div class="resume_tip">
                <div class="tiptit">小提示</div>
                <div class="tiptxt link_blue">
                    如果投递简历后7天内没有得到反馈，说明你获得面试机会的几率很低！
                </div>
            </div>

            <div class="apply_jobs_list_th">
                <div class="th1">申请的职位</div>
                <div class="th2">公司名称</div>
                <div class="th3">
                    <div class="input_100_30_div J_hoverinput J_dropdown J_listitme_parent">
                        <span class="J_listitme_text">投递反馈</span>
                        <div class="dropdowbox7 J_dropdown_menu">
                            <div class="dropdow_inner7">

                            </div>
                        </div>
                    </div>
                </div>
                <div class="th4">
                    <div class="input_100_30_div J_hoverinput J_dropdown J_listitme_parent">
                        <span class="J_listitme_text">投递时间</span>
                        <div class="dropdowbox7 J_dropdown_menu">
                            <div class="dropdow_inner7">
                                <ul class="nav_box">
                                    <li><a class="J_listitme" href="">全部</a></li>
                                    <li><a class="J_listitme" href="">3天内</a></li>
                                    <li><a class="J_listitme" href="">7天内</a></li>
                                    <li><a class="J_listitme" href="">15天内</a></li>
                                    <li><a class="J_listitme" href="">30天内</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="th5">操作</div>
                <div class="clear"></div>
            </div>
            @if($job->first())
                @foreach($job as $item)
                    <div class="apply_jobs_list J_hoverbut">
                        <div class="td1 link_blue substring">
                            &nbsp;&nbsp;<a href="{{url('/job/info',[$item->job_id])}}" target="_blank"
                                           title="">{{$item->jobs_name}}</a>
                        </div>
                        <div class="td2 link_gray6 substring">
                            <a href="" target="_blank" title="">{{$item->company_cn}}</a>
                        </div>

                        <div class="td3 n">
                            @if($item->status == 3)
                                邀请面试
                            @elseif($item->status == 4)
                                职位不匹
                            @else
                                企业未查看
                            @endif
                        </div>


                        <div class="td4">{{date("Y-m-d",$item->create_time)}}</div>
                        <div class="td5">
                            <a href="javascript:;"
                               url="{:U('personal/del_jobs_apply',array('y_id'=>$vo['did']))}"
                               class="but2 J_hoverbut delete"></a>
                            <div class="clear"></div>
                        </div>
                        <div class="clear"></div>
                    </div>
                @endforeach

                {{--<div class="apply_jobs_list_but">--}}
                {{--<div class="td1">--}}
                {{--<input class="J_allSelected" type="checkbox"/>--}}
                {{--</div>--}}
                {{--<div class="td2">--}}
                {{--<div class="but_gray_80_32 J_hoverbut delall">删除</div>--}}
                {{--</div>--}}
                {{--<div class="clear"></div>--}}
                {{--</div>--}}

                <div class="qspage">{{$job->links()}}</div>
            @else

                <div class="res_empty">
                    抱歉，没有找到符合您条件的记录，建议您修改筛选条件后重试
                </div>
            @endif

        </div>
        <div class="clear"></div>
    </div>
</div>
<!--word简历结束 -->


<div class="clear"></div>
<script type="text/javascript" src="{{asset('static/js/jquery.disappear.tooltip.js')}}"></script>
<script type="text/javascript" src="{{asset('static/js/jquery.dropdown.js')}}"></script>
<script type="text/javascript" src="{{asset('static/js/jquery.listitem.js')}}"></script>
<script type="text/javascript" src="{{asset('static/js/jquery.modal.userselectlayer.js')}}"></script>

<script>
    let QS_trade = ["1,消防", "2,安监"];
    let QS_jobtag = ["145,环境好", "146,年终奖", "147,双休", "148,五险一金", "149,加班费", "150,朝九晚五", "151,交通方便", "152,加班补助", "153,包食宿", "154,管理规范", "155,有提成", "156,全勤奖", "157,有年假", "158,专车接送", "159,有补助", "160,晋升快", "161,车贴", "162,房贴", "164,技术培训", "165,旅游"]
    //切换
    $('.J_showitems').live('click', function (e) {
        $('.J_itemsmenu').hide();
        $('.items').show();
        let $parentDom = $(this).closest('.J_itemsbox');
        $(this).closest('.items').hide();
        $parentDom.find('.J_itemsmenu').show();
    });
    // 取消通用
    $('.J_closeitems').live('click', function (e) {
        let $parentDom = $(this).closest('.J_itemsbox');
        $(this).closest('.J_itemsmenu').hide();
        $parentDom.find('.items').show();
    });
    // 保存基本信息
    $('.J_saveitems_baseinfo').live('click', function (e) {
        // 提交之前先验证
        let name = $.trim($('#name').val());
        let sex = $.trim($('#sex').val());
        let birth = $.trim($('#birth').val());
        let house = $.trim($('#house').val());
        let education = $.trim($('#education').val());
        let experience = $.trim($('#experience').val());
        let telephone = $.trim($('#telephone').val());
        if (name === "") {
            disapperTooltip("remind", "请填写姓名");
            return false;
        }
        if (sex === "") {
            disapperTooltip("remind", "请选择性别");
            return false;
        }
        if (birth === "") {
            disapperTooltip("remind", "请选择出生年份");
            return false;
        }
        if (house !== "" && house.length > 20) {
            disapperTooltip("remind", "现居住地应在1~20个字内");
            return false;
        }
        if (education === "") {
            disapperTooltip("remind", "请选择学历");
            return false;
        }
        if (experience === "") {
            disapperTooltip("remind", "请选择工作经验");
            return false;
        }

        $('.J_saveitems_baseinfo').val('保存中...').addClass('btn_disabled').prop('disabled', !0);
        // 提交表单
        $.ajax({
            url: "{{url('member/ajax_save_basic_info')}}",
            type: 'POST',
            dataType: 'json',
            data: {
                name: name,
                sex: sex,
                birth: birth,
                house: house,
                education: education,
                experience: experience,
                telephone: telephone,
            }
        }).done(function (res) {
            if (res.status === 1) {
                // 如果操作成功就同步修改的值
                $('[data-sub="name"]').text($('#name').val());
                $('[data-sub="sex"]').text($('#email').val());
                // 计算年龄
                let cYear = parseInt($('#birth').val());
                let nowDate = new Date();
                let nowYear = nowDate.getFullYear();
                let ageNum = parseInt(nowYear - cYear);
                $('[data-sub="birth"]').text(ageNum);
                $('[data-sub="education"]').text($('.for_education').text());
                $('[data-sub="experience"]').text($('.for_experience').text());
                //籍贯
                $('[data-sub="house"]').text($('#house').val());
                $('.J_saveitems_baseinfo').val('保存').removeClass('btn_disabled').prop('disabled', 0);
                // 关闭操作框
                let $parentDom = $('.J_saveitems_baseinfo').closest('.J_itemsbox');
                $('.J_saveitems_baseinfo').closest('.J_itemsmenu').hide();
                $parentDom.find('.items').show();
            } else {
                $('.J_saveitems_baseinfo').val('保存').removeClass('btn_disabled').prop('disabled', 0);
                disapperTooltip("remind", "更新失败请重新提交");
            }
        }).fail(function () {
            $('.J_saveitems_baseinfo').val('保存').removeClass('btn_disabled').prop('disabled', 0);
            disapperTooltip("remind", "更新失败请重新提交");
        });
    });
    // 保存求职意向
    $('.J_saveitems_intention').live('click', function (e) {
        // 提交之前先验证
        let current = $.trim($('#current').val());
        let nature = $.trim($('#nature').val());
        let trade = $.trim($('#trade').val());
        let intentionJobs = $.trim($('#intention_jobs_id').val());
        let district = $.trim($('#district').val());
        let wageValue = $.trim($('#wage').val());
        if (current == "") {
            disapperTooltip("remind", "请选择目前状态");
            return false;
        }
        if (natureValue == "") {
            disapperTooltip("remind", "请选择工作性质");
            return false;
        }
        if (intentionJobsValue == "") {
            disapperTooltip("remind", "请选择期望职位");
            return false;
        }
        if (districtValue == "") {
            disapperTooltip("remind", "请选择工作地区");
            return false;
        }
        if (wageValue == "") {
            disapperTooltip("remind", "请选择期望薪资");
            return false;
        }
        // 提交表单
        $.ajax({
            url: "{:U('Personal/ajax_save_basic')}",
            type: 'POST',
            dataType: 'json',
            data: {
                pid: pid,
                current: currentValue,
                nature: natureValue,
                trade: tradeValue,
                intention_jobs_id: intentionJobsValue,
                district: districtValue,
                wage: wageValue
            }
        })
            .done(function (data) {
                if (parseInt(data.status)) {
                    // 如果操作成功就同步修改的值
                    $('[data-sub="current"]').text($('.for_current').text());
                    $('[data-sub="nature"]').text($('.for_nature.checked').text());
                    $('[data-sub="trade"]').text($('.for_trade').text());
                    $('[data-sub="district"]').text($('.for_district').text());
                    $('[data-sub="wage"]').text($('.for_wage').text());

                    // 关闭操作框
                    let $parentDom = $('.J_saveitems_intention').closest('.J_itemsbox');
                    $('.J_saveitems_intention').closest('.J_itemsmenu').hide();
                    $parentDom.find('.items').show();
                    if (data.data != '') {
                        disapperTooltip("remind", data.msg);
                    } else {
                        $('[data-sub="intention_jobs"]').text($('.for_intention_jobs').text());
                    }
                } else {
                    disapperTooltip("remind", data.msg);
                }
            })
            .fail(function () {
                disapperTooltip("remind", "更新失败请重新提交");
            });
    });
    // 添加自我描述 保存
    $('.J_saveitems_specialty').live('click', function (e) {
        // 提交之前先验证
        let specialtyValue = $.trim($('#specialty').val());
        if (specialtyValue == "") {
            disapperTooltip("remind", "请填写自我描述");
            return false;
        }

        // 提交表单
        $.ajax({
            url: "/member/ajax_save_specialty",
            type: 'POST',
            dataType: 'json',
            data: {specialty: specialtyValue}
        }).done(function (data) {
            if (parseInt(data.status)) {
                let htmlVal = $('#specialty').val();
                $('.specialty_box').removeClass('empty font_gray9').addClass('describe font_gray6').text(htmlVal);
                // 关闭操作框
                let $parentDom = $('.J_saveitems_specialty').closest('.J_itemsbox');
                $('.J_saveitems_specialty').closest('.J_itemsmenu').hide();
                $parentDom.find('.items').show();
                check_complete_percent_allowance();
            } else {
                disapperTooltip("remind", data.msg);
            }
        })
            .fail(function () {
                disapperTooltip("remind", "更新失败请重新提交");
            });
    });
</script>
</body>
</html>
